package wu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wu.pojo.Dept;
import wu.service.DeptService;

import java.util.List;

@RestController
public class DeptController {

    @Autowired
    private DeptService deptService;

    @RequestMapping("/dept/get/{id}")
    public Dept findById(@PathVariable("id") Long id){
        return deptService.getById(id);
    }

    @RequestMapping("/dept/all")
    public List<Dept> findAll(){
        return deptService.list();
    }
//这是分页的
    @RequestMapping("/dept/page")
    public List<Dept> findString(){
        return deptService.findData();
    }

    //这个是写mybatis。xml文件进行实现的啊
    @RequestMapping("/dept/xml")
    public List<Dept> findXml(){
        return deptService.xml();
    }

    //这个是注解进行实现的啊
    @RequestMapping("/dept/annotion/{id}")
    public Dept findXml(@PathVariable("id")Long id){
        return deptService.findAnnotion(id);
    }
}
